<html xmlns="http://www.w3.org/1999/xhtml"><head><style type="text/css">
dt {
  font-style: italic;
  margin-top: 15px;
  margin-bottom: 3px;
  margin-left: 0px;
  border-bottom: 1px dotted black;
}
dd {
  margin-left: 10px;
}
table {
  border-collapse:collapse;
  border: 1px solid black;
  margin-top: 7px;
}
th {
  border: 1px solid black;
  padding: 3 7 3 7;
}
td {
  border: 1px solid black;
  padding: 3 7 3 7;
}
</style></head><body><p><a name="ldc"></a><b>ldc</b> :
  push single-word constant onto stack : <a href="opcodes.html">index</a> : <a href="http://asm.objectweb.org/asm40/javadoc/user/org/objectweb/asm/MethodVisitor.html#visitLdcInsn(java.lang.Object)">visitLdcInsn()</a></p><dl><dt>Description</dt><dd>ldc pushes a one-word constant onto the operand stack.
ldc takes a single parameter, <i xmlns="">&lt;</i>value<i xmlns="">&gt;</i>, which is
the value to push. The following Java types can be pushed using ldc:<br></br>	int
	float
	String<br></br>Pushing a String causes a reference to a java.lang.String object to be
constructed and pushed onto the operand stack. Pusing an int or a float causes
a primitive value to be pushed onto the stack.</dd><dt>Exceptions</dt><dd>OutOfMemoryError - not enough memory to allocate a reference to a
String</dd><dt>Example</dt><dd><pre>
ldc "Hello World"     ; push string "Hello World" onto stack
ldc 10                ; push the integer 10
ldc 1.54              ; push the single-precision float 1.54
</pre></dd><dt>Notes</dt><dd>1. Where possible, its more efficient to use one of bipush,
sipush, or one of the const instructions instead of ldc.<br></br>2. If the same string constant (i.e. a string with the same sequence of
characters) appears in several different class files, only one String instance
is built for that constant. The String.intern() method can be used to retrieve
the instance used for a given sequence of characters.</dd><dt>See also</dt><dd><a href="ref-bipush.html">bipush</a> <a href="ref-.html"></a> <a href="ref-sipush.html">sipush</a> <a href="ref-.html"></a> <a href="ref-ldc_w.html">ldc_w</a> <a href="ref-.html"></a> <a href="ref-ldc2_w.html">ldc2_w</a> <a href="ref-.html"></a> <a href="ref-aconst_null.html">aconst_null</a> <a href="ref-.html"></a> <a href="ref-iconst_m1.html">iconst_m1</a> <a href="ref-.html"></a> <a href="ref-iconst_n.html">iconst_n</a> <a href="ref-.html"></a> <a href="ref-lconst_l.html">lconst_l</a> <a href="ref-.html"></a> <a href="ref-fconst_f.html">fconst_f</a> <a href="ref-.html"></a> <a href="ref-dconst_d.html">dconst_d</a> </dd><dt>Stack</dt><dd><table xmlns="">
<tr>
<td>
<b>Before </b>
</td>
<td><b>After</b></td></tr>
<tr>
<td>...</td>
<td>&lt;value&gt;</td></tr>
<tr>
<td></td>
<td>...</td></tr>
</table></dd><dt>Bytecode</dt><dd><table xmlns="">
<tr>
<td>
<b> Type </b>
</td>
<td><b>Description</b></td></tr>
<tr>
<td>
u1 
</td>
<td>ldc
opcode = 0x12 (18)
</td></tr>
<tr>
<td>
u1 
</td>
<td>index</td></tr>
</table></dd></dl></body></html>